home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Apple Macintosh Developer Technical Support
- **
- ** File: IdleTasks.c
- ** Written by: Eric Soldan
- **
- ** Copyright © 1990-1993 Apple Computer, Inc.
- ** All rights reserved.
- */
-
- /* You may incorporate this sample code into your applications without
- ** restriction, though the sample code has been provided "AS IS" and the
- ** responsibility for its operation is 100% yours. However, what you are
- ** not permitted to do is to redistribute the source as "DSC Sample Code"
- ** after having made changes. If you're going to re-distribute the source,
- ** we require that you make it clear in the source that the code was
- ** descended from Apple Sample Code, but that you've made changes. */
-
- /* This function is called when a null event is received. Do appropriate tasks
- ** for null event situations, such as handling balloon help for window. */
-
-
-
- /*****************************************************************************/
-
-
-
- #include "App.h" /* Get the application includes/typedefs, etc. */
- #include "App.protos.h" /* Get the prototypes for application. */
-
-
-
- /*****************************************************************************/
- /*****************************************************************************/
-
-
-
- #pragma segment Main
- void DoIdleTasks(EventRecord *event)
- {
- #ifndef __MWERKS__
- #pragma unused (event)
- #endif
-
- EventRecord evt;
- WindowPtr window;
- TEHandle te;
- Rect rr;
- KeyMap kk;
- short mm;
-
- if (TSMTEAvailable()) TSMEvent(event);
-
- GetKeys(kk);
- mm = (kk[1] & 0x8000) ? (cmdKey ) : 0;
- mm |= (kk[1] & 0x0004) ? (optionKey ) : 0;
- mm |= (kk[1] & 0x0008) ? (controlKey) : 0;
- mm |= (kk[1] & 0x0001) ? (shiftKey ) : 0;
- evt.what = nullEvent; /* Make valid null event, with modifiers. */
- evt.modifiers = mm;
- IsCtlEvent(nil, &evt, nil, nil);
-
- window = CTETargetInfo(&te, &rr);
- if (window) {
- if (rr.left < -8192) /* If TextEdit control is in the frame... */
- BeginFrame(window); /* Set clipping to the frame area. */
- else
- BeginContent(window); /* Else set clipping to the document area. */
- CTEIdle();
- EndContent(window); /* EndContent can be used to close a BeginFrame. */
- }
- }
-
-
-
-